package com.zhushou.util;

import android.app.Activity;

import com.zhushou.model.Test;

/**
 * 创建数据
 */
public class BaodianDataUitl {

	/*
	 * Test表: Number testId(测试题目Id) Number testType(测试题目类型) String
	 * question(测试题目问题) String answerA(测试题目选项如果有则填，无则留空) String
	 * answerB(测试题目选项如果有则填，无则留空) String answerC(测试题目选项如果有则填，无则留空) String
	 * answerD(测试题目选项如果有则填，无则留空) String answerE(测试题目选项如果有则填，无则留空) String
	 * answerF(测试题目选项如果有则填，无则留空) String answerG(测试题目选项如果有则填，无则留空) String
	 * answer(正确答案)
	 */
	/**
	 * 1是单选题，2是简答题
	 * 
	 * @param aty
	 * @param s2
	 *            选择类型
	 * @param s
	 *            试题id
	 * @param question
	 *            问题内容
	 * @param answer
	 *            答案
	 * @param testType
	 *            类型
	 */
	public static void createTest(Activity aty, String[] s2, String testId,
			String question, String answer, int testType) {
		Test po = null;
		switch (s2.length) {
		case 2:
			po = new Test(testId, testType, question, answer, s2[0].replace(
					"A、", ""), s2[1].replace("B、", ""), "", "", "", "", "", "");
			break;
		case 3:
			po = new Test(testId, testType, question, answer, s2[0].replace(
					"A、", ""), s2[1].replace("B、", ""),
					s2[2].replace("C、", ""), "", "", "", "", "");
			break;
		case 4:
			po = new Test(testId, testType, question, answer, s2[0].replace(
					"A、", ""), s2[1].replace("B、", ""),
					s2[2].replace("C、", ""), s2[3].replace("D、", ""), "", "",
					"", "");
			break;
		case 5:
			po = new Test(testId, testType, question, answer, s2[0].replace(
					"A、", ""), s2[1].replace("D、", ""),
					s2[2].replace("C、", ""), s2[3].replace("D、", ""),
					s2[4].replace("E、", ""), "", "", "");
			break;
		case 6:
			po = new Test(testId, testType, question, answer, s2[0].replace(
					"A、", ""), s2[1].replace("B、", ""),
					s2[2].replace("C、", ""), s2[3].replace("D、", ""),
					s2[4].replace("E、", ""), s2[5].replace("F、", ""), "", "");
			break;
		case 7:
			po = new Test(testId, testType, question, answer, s2[0].replace(
					"A、", ""), s2[1].replace("B、", ""),
					s2[2].replace("C、", ""), s2[3].replace("D、", ""),
					s2[4].replace("F、", ""), s2[5].replace("G、", ""),
					s2[6].replace("H、", ""), "");
			break;
		default:
			break;
		}
		po.save(aty);

	}

}
